#ifndef UTI_MQ_H_
#define UTI_MQ_H_
#pragma once
#include "sys_config.h"



class Mq
{
public:

	Mq(unsigned int size);

	~Mq();

	void ResetMq();

	char* GetData(unsigned int step)
	{
		char* out = m_pser + m_getindex;

		m_getindex += step;

		return (out);
	};

	void SetData(char* pdata, unsigned int step)
	{
		memcpy(m_pser + m_setindex, pdata, step);
		m_setindex += step;
	};

	char* AllocateMem(unsigned int step)
	{
		m_setindex += step;

		return (m_pser + m_setindex - step);
	}

private:
	char* m_pser;

	unsigned int m_setindex;

	unsigned int m_getindex;

	unsigned int m_size;


};

//
//class Mq
//{
//public:
//
//	Mq(unsigned int size);
//
//	~Mq();
//
//	CThostFtdcDepthMarketDataField* GetData()
//	{
//		return (m_pser + m_getindex++);
//	};
//
//	void SetData(CThostFtdcDepthMarketDataField* pdata)
//	{
//		memcpy(m_pser + m_setindex++, pdata, sizeof(CThostFtdcDepthMarketDataField));
//	};
//
//private:
//	CThostFtdcDepthMarketDataField* m_pser;
//
//	unsigned int m_setindex;
//
//	unsigned int m_getindex;
//
//	unsigned int m_size;
//
//};





#endif